import { alovaAuthServer, alovaInstance } from './index';

export const getAllUsers = () => {
  return alovaInstance.Get('/users', );
};
export const getUserById = (id) => alovaInstance.Get(`/users/${id}`);
export const createUser = (data) => {
  return alovaInstance.Post('/users', data);
};
export const updateUser = (data) => {
    return alovaInstance.Put('/users', data);
};
export const updateUserById = (data) => alovaInstance.Put(`/users/${data.id}`, data);
export const deleteUserById = (id) => alovaInstance.Delete(`/users/${id}`);
export const adminDashboard = () => alovaInstance.Delete('/admin/dashboard');
export const adminPermissions = () => alovaInstance.Delete('/admin/permissions');
export const logout = () => alovaAuthServer.Post('/logout');
// Expert
export const getAllExperts = () => alovaInstance.Get('/experts');
export const getExpertById = (id) => alovaInstance.Get(`/experts/${id}`);
export const addExpert = (data) => alovaInstance.Post('/experts', data);
export const updateExpertById = (id, data) => alovaInstance.Put(`/experts/${id}`, data);
export const updateExpert = (data) => alovaInstance.Put(`/experts/${data.id}`, data);
export const deleteExpertById = (id) => alovaInstance.Delete(`/experts/${id}`)
// Project
export const getAllProjects = () => alovaInstance.Get('/projects');
export const getProjectById = (id) => alovaInstance.Get(`/projects/${id}`);
export const addProject = (data) => alovaInstance.Post('/projects', data);
export const updateProjectById = (id, data) => alovaInstance.Put(`/projects/${id}`, data);
export const updateProject = (data) => alovaInstance.Put(`/projects/${data.id}`, data);
export const deleteProjectById = (id) => alovaInstance.Delete(`/projects/${id}`)
// Extraction
export const getAllExtractions = () => alovaInstance.Get('/extractions');
export const getExtractionById = (id) => alovaInstance.Get(`/extractions/${id}`);
export const addExtraction = (data) => alovaInstance.Post('/extractions', data);
export const updateExtractionById = (id, data) => alovaInstance.Put(`/extractions/${id}`, data);
export const updateExtraction = (data) => alovaInstance.Put(`/extractions/${data.id}`, data);
export const deleteExtractionById = (id) => alovaInstance.Delete(`/extractions/${id}`)
// ExtractionResult
export const getAllExtractionResults = () => alovaInstance.Get('/extraction-results');
export const getExtractionResultById = (id) => alovaInstance.Get(`/extraction-results/${id}`);
export const getExtractionResultByExtractionId = (id) => alovaInstance.Get(`/extraction-results/extraction/${id}`);
export const addExtractionResult = (data) => alovaInstance.Post('/extraction-results', data);
export const genExtractionResultByExtractionId = (extractionId) => alovaInstance.Post(`/extraction-results/generate?extractionId=${extractionId}`);
export const updateExtractionResultById = (id, data) => alovaInstance.Put(`/extraction-results/${id}`, data);
export const updateExtractionResult = (data) => alovaInstance.Put(`/extraction-results/${data.id}`, data);
export const deleteExtractionResultById = (id) => alovaInstance.Delete(`/extraction-results/${id}`)
// Profession
export const getAllProfessions = () => alovaInstance.Get('/professions');
export const getProfessionById = (id) => alovaInstance.Get(`/professions/${id}`);
export const addProfession = (data) => alovaInstance.Post('/professions', data);
export const updateProfessionById = (id, data) => alovaInstance.Put(`/professions/${id}`, data);
export const updateProfession = (data) => alovaInstance.Put(`/professions/${data.id}`, data);
export const deleteProfessionById = (id) => alovaInstance.Delete(`/professions/${id}`)